

//type:"information"||"success"||"alert"||"error",

compono.ui.Message = compono.ui.Window.Class({
	name:"Message",
	
	type:false,
	timer:1,
	TIMER_ID:false,
	
	title:false,
	description:false,
	
	zIndex:10000,

	modal:true,
	fixed:true,
	openup:false,
	
	INSTANCES:false,
	
	constructor:function(proto)
	{
		if(proto){
			Object.extend(this, proto)
		};
	},
	run:function(element){
		
		if(element&&element.nodeType){
			this.html = this.$(element);
			if(!this.type){
				if(this.html.hasClassName("message-success")){
					element = "success";
				}else if(this.html.hasClassName("message-alert")){
					element = "alert";
				}else if(this.html.hasClassName("message-information")){
					element = "information";
				}else if(this.html.hasClassName("message-error")){
					element = "error";
				}
			}else{
				element = this.type || this.html.attr("message-type");
			}
		}else{
			
			switch(element.toLowerCase()){
				case "alert":
				case "error":
					if(!this.html){
						var d = this.$D();
						d.DIV({"class":"message"},
							d.DIV({"class":"body"},
								d.H2({"class":"title"}),
								d.H3({"class":"content"})
							)
						);
						this.html = this.build();
					}
					break;
				case "information":
				case "success":
				default:
					if(!this.html){
						this.html = this.build();
					};
					this.modal = false;
					this.zIndex = 0;
					this.fixed = false;
					this.position = false;
					this.canDrag = false;
					break;
			}
			
			this.$(this.html);
			this.html.appendClassName("message")
			this.html.appendClassName("message-" + element)

		};
	

		
		this.html.windowElement = this;
		this.windowResize.scope = this;
		this.windowScroll.scope = this;	
		
		return this;
	},
	confirm:function(element){
		return this.show();
	},
	alert:function(){
		this.show();
		if(this.timer){
			this.TIMER_ID = this.hide.timeout(this.timer,this);
		}
	}
})


//Instances array
compono.ui.Message.INSTANCES = [];
compono.ui.Message.prototype.INSTANCES = compono.ui.Message.INSTANCES;